import BuffBase from "../Manager/BuffBase";

//攻击力上升
export default class AttackDamageUP extends BuffBase {

    RemoveTime = 0;
    RemoveMaxTime = 2;
    DownSpeed = 0.5;
    MeshObj: Laya.Sprite3D;
    Count: number = 0;
    InitBuffBase() {
        //super.InitBuffBase();
    }

    BuffOccur() {
        // let Url = EssentialResUrls.prefab_url(PrefabNames.HuoqiuUp);
        // let Name = PrefabNames.HuoqiuUp;
        // ResLoad.Load(Url, Laya.Handler.create(this, () => {
        //     let Mes = PropsGenerationManager.Instance.CreatorFixedItem(Url, Name, this.m_SoldiersBase.m_SceneSprite3d);
        //     this.MeshObj = Mes.getChildAt(0) as Laya.Sprite3D;
        //     this.m_SoldiersBase.m_SceneSprite3d.addChild(Mes);
        //     Mes.transform.localPosition = new Laya.Vector3(0, 0, 0);
        //     this.MeshObj.transform.localScaleY = 1;
        //     this.MeshObj.transform.localScale = new Laya.Vector3(1, 1, 1);
        // }));
        this.Count = 1;
    }
    RefreshBuff() {
        this.RemoveTime = 0;
        this.Count += 1;
        console.log(this.Count);
    }
    //Buff每帧调用
    BuffOnTick() {
        this.RemoveTime += (Laya.timer.delta / 1000);
        if (this.RemoveTime >= this.RemoveMaxTime) {
            this.BuffRemoved();
            return;
        }
        //this.m_SoldiersBase.m_TempAttributeBase.m_Damage = this.m_SoldiersBase.m_TempAttributeBase.m_Damage + (this.m_SoldiersBase.m_TempAttributeBase.m_Damage * (0.02 * this.Count));

    }
    //Buff移除
    BuffRemoved() {
        if (this.MeshObj != null) {
            this.MeshObj.removeSelf();
            this.MeshObj.destroy();
        }
        this.MeshObj = null;
        super.BuffRemoved();
    }
    //受到伤害
    BuffBeHurt() {

    }
    //攻击时
    BuffOnHit() {

    }
    //被杀死时
    BuffBeforeKilled() {
        this.BuffRemoved();
    }
    //敌人死亡时
    BuffAfterKilled() {

    }

}